package com.ruoyi.project.WebMoudle.accountDetails.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.framework.aspectj.lang.annotation.DataScope;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.WebMoudle.accountDetails.mapper.AccountDetailsMapper;
import com.ruoyi.project.WebMoudle.accountDetails.domain.AccountDetails;
import com.ruoyi.project.WebMoudle.accountDetails.service.IAccountDetailsService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 记账详情Service业务层处理
 * 
 * @author ruoyi
 * @date 2020-07-14
 */
@Service
public class AccountDetailsServiceImpl implements IAccountDetailsService 
{
    @Autowired
    private AccountDetailsMapper accountDetailsMapper;

    /**
     * 查询记账详情
     * 
     * @param id 记账详情ID
     * @return 记账详情
     */
    @Override
    public AccountDetails selectAccountDetailsById(Long id)
    {
        return accountDetailsMapper.selectAccountDetailsById(id);
    }

    /**
     * 查询记账详情列表
     * 
     * @param accountDetails 记账详情
     * @return 记账详情
     */
    @Override
    @DataScope(deptAlias = "d", userAlias = "u")
    public List<AccountDetails> selectAccountDetailsList(AccountDetails accountDetails)
    {
        return accountDetailsMapper.selectAccountDetailsList(accountDetails);
    }

    /**
     * 新增记账详情
     * 
     * @param accountDetails 记账详情
     * @return 结果
     */
    @Override
    public int insertAccountDetails(AccountDetails accountDetails)
    {
        accountDetails.setCreateTime(DateUtils.getNowDate());
        return accountDetailsMapper.insertAccountDetails(accountDetails);
    }

    /**
     * 修改记账详情
     * 
     * @param accountDetails 记账详情
     * @return 结果
     */
    @Override
    public int updateAccountDetails(AccountDetails accountDetails)
    {
        accountDetails.setUpdateTime(DateUtils.getNowDate());
        return accountDetailsMapper.updateAccountDetails(accountDetails);
    }

    /**
     * 删除记账详情对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteAccountDetailsByIds(String ids)
    {
        return accountDetailsMapper.deleteAccountDetailsByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除记账详情信息
     * 
     * @param id 记账详情ID
     * @return 结果
     */
    @Override
    public int deleteAccountDetailsById(Long id)
    {
        return accountDetailsMapper.deleteAccountDetailsById(id);
    }

    @Override
    public List<AccountDetails> queryMoneyList(Long shopId,String myMoth) {
        return accountDetailsMapper.queryMoneyList(shopId,myMoth);
    }
}
